package org.atf.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.atf.model.dao.AtfSchedulerDAO;
import org.atf.model.entity.JobSummary;
import org.atf.model.entity.Jobs;
import org.atf.model.entity.Preference;

public class SchedulerController {
	AtfSchedulerDAO atfSchedulerDAO = new AtfSchedulerDAO();
	
	public List<String> getSchedulersUniqueRegions(){
		return atfSchedulerDAO.getUniqueRegions();
	}
	
	public List<Jobs> getSchedulersByRegion(String regionName){
		return atfSchedulerDAO.getSchedulersByRegion(regionName);
	}
	public Jobs getEmptySchedulerJob(){
		return new Jobs();
	}
	
	public String addSchedulerJob(Jobs job){
		atfSchedulerDAO.addSchedulerJob(job);
		return "OK";
	}
	
	public String updateSchedulerJob(Jobs job){
		
		atfSchedulerDAO.updateWebSchedulerJob(job);
		return "OK";
	}
	public Jobs getSchedulerJob(Integer jobId){
		return atfSchedulerDAO.getJobsId(jobId);
	}
	public String deleteSchedulerJob(Integer jobId){
		atfSchedulerDAO.deleteSchedulerJob(jobId);
		return "OK";
	}
	public List<Preference> getJobsPreferencesList(Integer jobId){	
		return atfSchedulerDAO.getPreference(jobId);
	}
	 
	public String addPreference(Integer jobId,Preference preference){
		atfSchedulerDAO.insertPreference(jobId,preference);
		return "OK";
	}
	public String deletePreference(Integer JobId,Integer prefId){
		atfSchedulerDAO.deletePreference(JobId, prefId);
		return "OK";
	}
	public List<JobSummary> getJobSummaryDetails(Integer jobId, String jobName, String jobRegion, Date cDate){
		List<JobSummary> result= new ArrayList<JobSummary>();
		result=atfSchedulerDAO.getJobSummaryDetails( jobId,  jobName,  jobRegion,  cDate);
		return result;
	}
	
}
